Colin Walters [Thu, 17 Nov 2016 16:39:27 +0000 (11:39 -0500)]
[TSAN] main: Stop calling g_set_prgname()
It turns out this is basically racy with the presence of other
threads. It was really cosmetic so let's stop doing it and make
`-fsanitize=thread` happy.
Closes: #582
Approved by: jlebon
Colin Walters [Thu, 17 Nov 2016 18:48:58 +0000 (13:48 -0500)]
[UBSAN] deltas: Don't call memset(NULL, NULL, 0) with no xattrs
This is actually fine in practice, but it triggers this
`-fsanitize=undefined` warning I saw in the test suite log:
```
src/libostree/ostree-repo-static-delta-compilation.c:160:10: runtime error: null pointer passed as argument 1, which is declared to never be null
```
Closes: #584
Approved by: jlebon
William Manley [Tue, 19 Jul 2016 02:14:26 +0000 (03:14 +0100)]
ostree commit: Fix combining trees with multiple --tree=ref arguments
You'd expect
ostree commit --tree=ref=A --tree=ref=B
to produce a commit with the union of the trees given. Instead you'd get
a commit with the contents of just the latter commit. This was due to an
optimisation where we'd skip filling out the `files` and `subdirs`
members of the mtree, just filling in the metadata instead. This backfires
becuase this same code relies on checking the `files` and `subdirs` members
itself to work out whether the mtree is empty.
This commit removes the optimisation, fixing the bug. Maybe there's a way
to keep the optimisation and still fix the bug but it's not obvious to
me.
Closes: #581
Approved by: cgwalters
Colin Walters [Wed, 16 Nov 2016 16:50:43 +0000 (11:50 -0500)]
lib: Add an API to GPG verify a commit given a remote
Conceptually we've been moving towards having our GPG verification
paths be per-remote. The code internally supports this, but we
didn't expose an API to use it conveniently.
This came up when trying to add a new `gpgkeypath` option, since
right now rpm-ostree manually finds keyrings for the remote, and
hence it wasn't looking at the keypath, and said "Unknown key"
in status.
Adding an API fixes this nicely.
Closes: #576
Approved by: giuseppe
Colin Walters [Wed, 16 Nov 2016 14:13:54 +0000 (09:13 -0500)]
Add "gpgkeypath" option to remotes
For Project Atomic, we already have RPM signatures which use files in
`/etc/pki/rpm-gpg`. It's convenient to simply bind the OSTree remote
configuration to those file paths, rather than having duplicate key
data.
This does mean that we need to parse the files for verification, so we
end up importing them into the verifier's temporary keyring, which is
a bit ugly, but it's what other projects do.
Closes: https://github.com/ostreedev/ostree/issues/573
Closes: #575
Approved by: giuseppe
Colin Walters [Wed, 16 Nov 2016 14:10:39 +0000 (09:10 -0500)]
lib: Split out helper function to create GPG context
In prep for future work.
Closes: #575
Approved by: giuseppe
Colin Walters [Wed, 16 Nov 2016 14:19:52 +0000 (09:19 -0500)]
lib: Define and use cleanup functions for gpgme
Just a cleanup in preparation for future work.
Closes: #575
Approved by: giuseppe
Alexander Larsson [Wed, 16 Nov 2016 21:46:45 +0000 (22:46 +0100)]
commit: Fix reading xattrs from OstreeRepoFile:s
When doing commit --tree=ref=XXX while at the same time applying some
form of modifier, ostree dies trying to read the xattrs using the
raw syscalls. We fix this by falling back to ostree_repo_file_get_xattrs()
in this case.
Also adds a testcase for this.
Closes: #577
Approved by: cgwalters
Colin Walters [Tue, 1 Nov 2016 17:51:55 +0000 (13:51 -0400)]
pull: Redo logic for "scanning"
What in the code is called "scanning" is ensuring (potentially
recursively) have an object, and if not, fetching it. And then if
it's metadata, parsing it and finding new objects to fetch.
This logic has grown fairly complex. What I'm trying to fix
right now is that if we're doing a pull-local to a remote repository
via `sshfs` (FUSE) we still end up scanning, which is inefficient.
We can take advantage of the "commitpartial" logic here - if a commit
isn't partial, it's complete, hence we don't need to scan it.
At the same time, I'm changing the logic here to *always* do scans for
dirtree objects. This will fix cases where multiple commits share
dirtree objects. We have "commitpartial" metadata, but no such concept
of partial/complete for dirtrees.
But, we'll only ever scan dirtrees if we scan commits, which is
what the section above fixes.
Closes: https://github.com/ostreedev/ostree/issues/543
Closes: #564
Approved by: alexlarsson
Colin Walters [Wed, 16 Nov 2016 02:03:26 +0000 (21:03 -0500)]
pull: Add support for `http-headers` option
Some deployments may want to gate access to content based on things
like OAuth. In this model, the client system would normally compute a
token and pass it to the server via an API.
We could theoretically support this in the remote config too, but
that'd be a bit weird for OAuth as the information is dynamic.
Therefore this cleans up the code a little bit to more clearly handle
the case that the fetcher is initialized from both remote config
data plus pull options.
Closes: #574
Approved by: giuseppe
Jonathan Lebon [Thu, 10 Nov 2016 17:56:37 +0000 (12:56 -0500)]
.redhat-ci.yml: no longer install libubsan & clang
Since they're now part of the auto-built image.
Closes: #572
Approved by: cgwalters
Colin Walters [Thu, 10 Nov 2016 16:42:35 +0000 (11:42 -0500)]
travis: Drop debian unstable since we can't fetch packages reliably
I don't know what's going on, I suspect mirror churn. Anyways,
it seems to be consistently failing now, so let's drop it.
Closes: #571
Approved by: jlebon
Colin Walters [Thu, 10 Nov 2016 16:27:43 +0000 (11:27 -0500)]
Release 2016.13
Closes: #570
Approved by: jlebon
Jonathan Lebon [Wed, 9 Nov 2016 02:37:43 +0000 (21:37 -0500)]
.redhat-ci.yml: use new build key
This allows us to more concisely separate building from testing, which
in turn gives us a nicer inheritance pattern in our case.
See also: https://github.com/jlebon/redhat-ci/issues/11
Closes: #569
Approved by: cgwalters
Colin Walters [Thu, 3 Nov 2016 12:32:19 +0000 (08:32 -0400)]
deltas: Only keep one file open at a time during compilation
Otherwise it's possible for us to exhaust available file descriptors
or (on 32 bit) run up against mmap limits.
In the rollsum case, we didn't need to hold open the "from" object
at all. And in the bsdiff case, we weren't even looking at either of
the files until we started processing.
Also, while we have the patient open, switch to using O_TMPFILE
if available.
Closes: #567
Approved by: giuseppe
Sjoerd Simons [Mon, 17 Oct 2016 20:47:58 +0000 (22:47 +0200)]
Update documentation for cookie handling commands
Closes: #531
Approved by: cgwalters
Sjoerd Simons [Mon, 17 Oct 2016 20:53:32 +0000 (22:53 +0200)]
tests: Add test for the cookie jar handling
Closes: #531
Approved by: cgwalters
Sjoerd Simons [Mon, 17 Oct 2016 20:35:40 +0000 (22:35 +0200)]
trivial-httpd: Add support for checking cookies
Allow passsing a list of cookie key/values to trivial-httpd which should
be provided to allow downloads
Closes: #531
Approved by: cgwalters
Sjoerd Simons [Mon, 17 Oct 2016 20:30:41 +0000 (22:30 +0200)]
OsreeFetcher: Treat 403 as not found
Private Cloudfront instances return 403 for objects which don't exist
rather then a 404.
Change the fetcher to assume 403 is ok for download that are "optional"
rather then erroring out at that step (e.g. trying to download a static
delta if the remote repo doesn't have those)
Closes: #531
Approved by: cgwalters
Sjoerd Simons [Mon, 17 Oct 2016 20:30:14 +0000 (22:30 +0200)]
remote: Add commands to add and remove cookies for a remote
Add commands to add and remove cookies to a remotes cookie jar.
Closes: #531
Approved by: cgwalters
Sjoerd Simons [Mon, 17 Oct 2016 20:14:14 +0000 (22:14 +0200)]
remote: Add command to list cookies
Closes: #531
Approved by: cgwalters
Sjoerd Simons [Mon, 17 Oct 2016 19:39:38 +0000 (21:39 +0200)]
pull: Add per-remote cookie jar
Optionally read cookie jars for a remote to be used when downloading
data. This can be used for private repositories which require specific
cookies to be present, e.g. repositories hosted on Amazon cloudfront
using signed cookies.
Closes: #531
Approved by: cgwalters
Colin Walters [Tue, 1 Nov 2016 20:39:58 +0000 (16:39 -0400)]
pull: Don't do deltas with --commit-metadata-only
We should just download the commit objects directly, as it's
obviously a lot more efficient than deltas.
I had to generate a summary file in more places in the tests,
since once created, it needs to be updated.
Closes: https://github.com/ostreedev/ostree/issues/528
Closes: #566
Approved by: jlebon
Colin Walters [Tue, 1 Nov 2016 18:17:57 +0000 (14:17 -0400)]
repo: Don't put remote refs in the summary file
I was doing a chain of mirroring like A -> B -> C
And repo B had A as a remote. When I added B as
a remote to C, the summary file of B had a ref
upstream:foo/bar/baz, which caused all pulls from
B to C to fail, since the summary file is only
expected to have refs, not refspecs.
Closes: https://github.com/ostreedev/ostree/issues/561
Closes: #565
Approved by: jlebon
Sjoerd Simons [Sun, 30 Oct 2016 20:06:27 +0000 (21:06 +0100)]
Filter bootloader supplied kernel cmdline options
Various bootloader add kernel commandline options dynamically, filter
these out when grabbing boot options from /proc/cmdline. Specifically
grub adds BOOT_IMAGE and systemd-boot adds initrd.
Closes: #560
Approved by: cgwalters
Simon McVittie [Sun, 30 Oct 2016 13:52:51 +0000 (13:52 +0000)]
load_metadata_internal: don't leak GBytes
Found by valgrind memcheck. g_variant_new_from_bytes takes a ref to the
bytes, so we need to release the original ref.
Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #556
Approved by: cgwalters
Simon McVittie [Sat, 29 Oct 2016 17:47:11 +0000 (18:47 +0100)]
Fix some leaks of floating GVariants
ostree_repo_pull_with_options() and ostree_repo_remote_change() don't
sink floating GVariant arguments, and doing so now would be an
ABI change; so don't rely on them to do so.
Leak found with valgrind memcheck.
Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #556
Approved by: cgwalters
Simon McVittie [Thu, 27 Oct 2016 11:31:52 +0000 (12:31 +0100)]
ot_remote_builtin_show_url: autofree context
Leak found with valgrind memcheck.
Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #556
Approved by: cgwalters
Simon McVittie [Thu, 27 Oct 2016 11:32:10 +0000 (12:32 +0100)]
ostree_repo_pull_with_options: clear dirs array
Leak found with valgrind memcheck.
Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #556
Approved by: cgwalters
Simon McVittie [Sat, 29 Oct 2016 17:36:19 +0000 (18:36 +0100)]
keyfile_set_from_vardict: free the string array
g_variant_get_strv is (transfer container): the caller is expected to
free the array, but not the individual strings.
Leak found with valgrind memcheck.
Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #556
Approved by: cgwalters
Simon McVittie [Sat, 29 Oct 2016 17:37:09 +0000 (18:37 +0100)]
_ostree_sysroot_write_deployments_internal: stop leaking hash table
It appears the result of assign_bootserials() is never actually used,
but I haven't changed it to return void right now.
Leak found with valgrind memcheck.
Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #556
Approved by: cgwalters
Simon McVittie [Sat, 29 Oct 2016 17:37:32 +0000 (18:37 +0100)]
ostree_sysroot_upgrader_finalize: free new_revision
Leak found with valgrind memcheck.
Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #556
Approved by: cgwalters
Simon McVittie [Sun, 30 Oct 2016 14:14:09 +0000 (14:14 +0000)]
ostree_admin_option_context_parse: explicitly clean up when exiting early
The cleanup attribute doesn't clean up before calling a noreturn
function like exit(). Explicitly clean up the pointer variables
(but don't assume that a simple g_object_unref() would be OK either,
in case the behaviour of the cleanup attribute changes).
This isn't a real leak since we're about to exit anyway, but if we
don't fix it then valgrind memcheck will make the tests fail.
Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #559
Approved by: cgwalters
Simon McVittie [Sun, 30 Oct 2016 14:12:02 +0000 (14:12 +0000)]
ostree_builtin_pull: consistently set free-function on refs_to_fetch
We are relying on the GPtrArray to free its contents, but we only
give it a free-function on one code path.
Found by valgrind memcheck.
Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #559
Approved by: cgwalters
Simon McVittie [Sun, 30 Oct 2016 14:11:23 +0000 (14:11 +0000)]
ot_admin_builtin_set_origin: don't leak options GVariant
Found by valgrind memcheck.
Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #559
Approved by: cgwalters
Simon McVittie [Sat, 29 Oct 2016 20:31:18 +0000 (21:31 +0100)]
_ostree_kernel_args_replace_take: don't leak when replacing
If !existed, then we add arg to kargs->order, where it will be freed
by that array's free-function. However, if the kernel argument did
already exist, we have to either free arg ourselves (and make sure
the old key is what appears in the hash table), or do a linear search
on kargs->order to replace the old key with the new.
Leak found by valgrind memcheck.
Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #559
Approved by: cgwalters
Simon McVittie [Fri, 7 Oct 2016 22:12:29 +0000 (23:12 +0100)]
Distribute valgrind suppressions in tarballs
Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #557
Approved by: cgwalters
Simon McVittie [Fri, 7 Oct 2016 22:09:29 +0000 (23:09 +0100)]
Distribute test scripts even if we wouldn't run them
This fixes a "make dist" tarball produced on a minimal system and run on a
non-minimal system. Automake knows that files that are only conditionally
included in dist_whatever_WHATEVER are to be distributed, but it does not
do the same for files that are only conditionally included in EXTRA_DIST,
which is how glib-tap.mk's various variables like dist_test_scripts work.
Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #557
Approved by: cgwalters
Simon McVittie [Sat, 8 Oct 2016 13:19:01 +0000 (14:19 +0100)]
Force C.UTF-8 or C locale for tests
Otherwise several tests fail, for example in this build done in a French
locale by Debian's reproducible builds initiative, to check whether
the resulting binaries are identical to what was produced in an
English locale:
<https://tests.reproducible-builds.org/debian/logs/unstable/amd64/ostree_2016.11-1.build2.log.gz>
(test-basic)
# error: Cannot write to repository: Permission non accordée
...
File 'error-message' doesn't match regexp 'Permission denied'
(test-help)
# Utilisation :
# ostree [OPTION...] COMMAND
...
File 'out' doesn't match regexp '[Uu]sage'
(test-pull-metalink)
# error: Erreur à la ligne 1, caractère 1 : Le document doit commencer avec un élément (par ex. <book>)
...
File 'err.txt' doesn't match regexp 'Document must begin with an element'
Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #558
Approved by: cgwalters
Colin Walters [Thu, 27 Oct 2016 17:51:55 +0000 (13:51 -0400)]
ci: Use -fsanitize=undefined by default
It's fast enough to use for CI testing by default, and it
can catch a lot of bad things.
Closes: #552
Approved by: jlebon
Colin Walters [Fri, 28 Oct 2016 13:32:02 +0000 (09:32 -0400)]
remote-refs: Add NULL terminator to options array
Caught by `-fsanitize=undefined`.
Closes: #552
Approved by: jlebon
Colin Walters [Thu, 27 Oct 2016 17:50:46 +0000 (13:50 -0400)]
libglnx: Bump to master (for -fsanitize fixes)
Closes: #552
Approved by: jlebon
Giuseppe Scrivano [Fri, 28 Oct 2016 12:44:09 +0000 (14:44 +0200)]
static-delta: find a similar filename using what is before '.' or '-'
Improve the heuristic to use only the part before the first '.' when
looking for a similar file in the current directory.
last versions of dracut generate reproducible initramfs files, but we
still fallback to the full file download if there is any minimal
change that causes a different checksum and file name.
This change extends that case to deal better with similar files that
have a different suffix.
This is the difference generating a static delta from
fedora-atomic/f24/x86_64/docker-host to fedora-atomic/f24/x86_64/testing/docker-host
before the patch:
fallback for
111ec866aa7ce3688407fa4a1ae7c9fca93dcee0b851fc9434c59ff947830cc7 (47.0 MB)
fallback for
c6a898265de22b02c89ea2f35d132628d0ee1c0a058052ed14fee5799c17904c (47.0 MB)
fallback for
fbce656249ece77260887ed873e445561b9d43bcb28a32e759c0b1bab89e7137 (6.6 MB)
fallback for
cfdb51457e47e0a0fe0bac38991a21279d2646ff2f019630c7b52a0cd3451397 (6.6 MB)
part 0 n:1972 compressed:
11239809 uncompressed:
33747412
part 1 n:1079 compressed:
9683681 uncompressed:
55641397
part 2 n:1507 compressed:
15050265 uncompressed:
44448838
part 3 n:101 compressed:
1865881 uncompressed:
31896086
part 4 n:278 compressed:
2452585 uncompressed:
52811323
part 5 n:18 compressed:67621 uncompressed:100220
uncompressed=
218645276 compressed=
40359842 loose=545102
rollsum=49 objects,
2117254 bytes
bsdiff=4067 objects
after the patch:
part 0 n:843 compressed:
19844109 uncompressed:
95443178
part 1 n:1223 compressed:
11188609 uncompressed:
33330401
part 2 n:990 compressed:
15762905 uncompressed:
61214132
part 3 n:1441 compressed:
20614573 uncompressed:
31534195
part 4 n:163 compressed:
2734997 uncompressed:
51356423
part 5 n:285 compressed:
2480813 uncompressed:
52902904
part 6 n:14 compressed:59125 uncompressed:75341
uncompressed=
325856574 compressed=
72685131 loose=533283
rollsum=51 objects,
57235332 bytes
bsdiff=4073 objects
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Closes: #554
Approved by: cgwalters
Jonathan Lebon [Thu, 27 Oct 2016 21:12:05 +0000 (17:12 -0400)]
delta: return valid enum member
If we can't figure out what endianness a delta is, we should just throw
ENDIAN_INVALID.
Resolves: #550
Closes: #553
Approved by: cgwalters
Colin Walters [Tue, 25 Oct 2016 16:07:16 +0000 (12:07 -0400)]
Define an initializer for GVariant{Builder,Dict}
So we build warning-free on GLib (< 2.50, >= 2.50). This
is a band aid until we hard-require >= 2.50.
Closes: #547
Approved by: jlebon
Jonathan Lebon [Thu, 27 Oct 2016 16:03:04 +0000 (12:03 -0400)]
.redhat-ci.yml: add clang
Clang has better detection for unused vars when using auto cleanup
functions. We should eventually just fold this back into the first
testsuite. But let's just turn it on for now, at least until it's
satisfied with the whole codebase.
Closes: #549
Approved by: cgwalters
Colin Walters [Thu, 27 Oct 2016 17:43:39 +0000 (13:43 -0400)]
deploy: Suppress unused variable warning for fscreatecon cleanup
Fixes the clang build.
Closes: #551
Approved by: jlebon
Colin Walters [Tue, 25 Oct 2016 17:16:14 +0000 (13:16 -0400)]
parse-datetime: Use labs() for long input value
Fixes a compliation warning with CLang, I didn't study it to
see whether this was a major issue or not.
Closes: #548
Approved by: jlebon
Colin Walters [Tue, 25 Oct 2016 17:11:12 +0000 (13:11 -0400)]
otutil: Note that ot_log_structured takes a printf format
This notably fixes compilation with CLang.
Closes: #548
Approved by: jlebon
Colin Walters [Tue, 25 Oct 2016 17:06:36 +0000 (13:06 -0400)]
tree-wide: Remove unused variables detected by CLang
CLang finds these, whereas GCC treats having
`__attribute__((cleanup))` as a use.
This obsoletes https://github.com/ostreedev/ostree/pull/411
Closes: #548
Approved by: jlebon
Colin Walters [Tue, 25 Oct 2016 14:40:45 +0000 (10:40 -0400)]
tests: Skip libarchive/selinux tests if in container without SELinux
I'm doing builds and `make check` inside a Docker container, with
selinux on as a build-time option, but no policy in the container.
This currently aborts. Let's not do that.
(This type of thing is why installed tests are a better model)
Closes: #546
Approved by: jlebon
Colin Walters [Mon, 24 Oct 2016 17:54:25 +0000 (13:54 -0400)]
docs: Link to releng-scripts
Now that the repo starts to implement some of this stuff.
Closes: #544
Approved by: jlebon
Alexander Larsson [Mon, 24 Oct 2016 09:12:15 +0000 (11:12 +0200)]
Fix pruning of partial commits
If we have a partial commit it is not an error for a dirmeta to be
missing (in fact, that is likely), so instead of returning a not-found
error from ostree_repo_traverse_commit() we ignore the error and
continue.
In particular, this means we don't stop early at the first
missing dirmeta, which previously caused ostree_repo_prune() to
thing the dirmetas after that to be unreached and thus purged.
Also, we remove the special casing in ostree_repo_prune() to
not report errors for commitpartial, because these should not
be reported anymore.
This fixes https://github.com/ostreedev/ostree/issues/541
Closes: #542
Approved by: cgwalters
Colin Walters [Fri, 21 Oct 2016 18:43:29 +0000 (14:43 -0400)]
Release 2016.12
Closes: #540
Approved by: cgwalters
Alexander Larsson [Fri, 21 Oct 2016 10:10:30 +0000 (12:10 +0200)]
detached metadata: Put these in transaction
If there is a transaction active, then we put writes to detached
metadata into the staging dir, and when reading it we look there
first. This allows transactions to be aborted half-way without
writing the detached metadata into the repository (possibly
overwriting any old metadata from there).
This fixes https://github.com/ostreedev/ostree/issues/526
Closes: #539
Approved by: giuseppe
Alexander Larsson [Fri, 21 Oct 2016 08:13:54 +0000 (10:13 +0200)]
ostree_repo_read_commit_detached_metadata: Handle parent repo
If the detached metadata is not in the repo, try in the parent
repo if that is set.
Without this a commit will not gpg validate in the child repo
Closes: #539
Approved by: giuseppe
Alexander Larsson [Fri, 21 Oct 2016 09:16:42 +0000 (11:16 +0200)]
Fix regression for symlinks in bare-user repos
Commit
1d4f1b8878addd28059c3a3928640491755cd615 started using hardlinks
checkouts of symlinks. However, symlinks are not stored as symlink in the
repo for bare-user repos, so this breaks user-mode checkouts of such repos.
We fix this by checking for !is_symlink in the bare-user case.
This fixes:
https://github.com/ostreedev/ostree/issues/537
Closes: #538
Approved by: giuseppe
Jonathan Lebon [Wed, 19 Oct 2016 20:49:56 +0000 (16:49 -0400)]
.redhat-ci.yml: use projectatomic/ostree-tester
Same Dockerfile, but automated to rebuild on pushes.
Closes: #536
Approved by: giuseppe
Jonathan Lebon [Wed, 19 Oct 2016 16:37:54 +0000 (12:37 -0400)]
add .redhat-ci.yml and .redhat-ci.Dockerfile
Add a YAML file for the new Red Hat CI framework.
Rather than re-installing all the build deps everytime, which takes
time, I added a Dockerfile that we can wire up to the Docker Hub. For
now it lives at `jlebon/ostree-tester:rhci`, but we can move it under
the `projectatomic` org (or a new `ostree` org).
Closes: #535
Approved by: cgwalters
Colin Walters [Tue, 4 Oct 2016 19:23:04 +0000 (15:23 -0400)]
core: Do create hardlinks to symlinks for checkouts
I was noticing a recent performance issue with checkouts
which seemed to be mostly us going back to doing a `fsync()` on
directories.
Regardless, while looking at that, I saw we were spending time
creating new symlinks. Even though symlinks are small, it's still
better to hardlink them.
Going way back in time, the reason we weren't doing this is
because we were hitting `EMFILE` on ext4, but that was for
gnome-continuous which creates *many* build roots. Even
there though, they're just a cache, and we handle `EMFILE`.
For ostree-for-host-system, we don't expect to have many roots (just 3
at most transiently), so hardlinking symlinks does make sense.
Closes: #521
Approved by: jlebon
Jonathan Lebon [Fri, 14 Oct 2016 13:25:01 +0000 (09:25 -0400)]
OstreeFetcher: provide proxy credentials if needed
There seems to be an issue in libsoup which causes basic auth
credentials to not be passed to the proxy during requests. We thus have
to handle PROXY_UNAUTHORIZED responses and provide the auth ourselves.
Related: https://bugzilla.redhat.com/show_bug.cgi?id=
1370558
Related: https://bugzilla.gnome.org/show_bug.cgi?id=772932
Closes: #529
Approved by: cgwalters
Jonathan Lebon [Thu, 13 Oct 2016 16:05:54 +0000 (12:05 -0400)]
ostree-sysroot-deploy.c: delete redundant check
Just noticed this while inspecting the code. The deployments retrieved
by `_ostree_sysroot_list_deployment_dirs_for_os` will forcibly already
have a matching osname since it indirectly uses that same variable to
construct them. Having a check there makes it look like there may be
subtle corner cases, when there aren't.
Closes: #529
Approved by: cgwalters
Jonathan Lebon [Thu, 13 Oct 2016 15:56:46 +0000 (11:56 -0400)]
docs: amend vmlinuz & initramfs naming convention
I was confused while reading the docs how this could work, since in at
least the Fedora/CentOS/RHEL distros, they're named e.g.
initramfs-`uname -r`-$checksum.
Closes: #529
Approved by: cgwalters
Alexander Larsson [Wed, 5 Oct 2016 19:26:38 +0000 (21:26 +0200)]
pull: Support multiple specifications of --subpath
I need this in flatpak to avoid doing multiple pulls when doing
locale subsetting.
Closes: #523
Approved by: cgwalters
Alexander Larsson [Fri, 7 Oct 2016 14:28:57 +0000 (16:28 +0200)]
pull: Support inherit-transaction
If this is true, don't initiate, abort of commit a transaction, instead
it is assumed that the caller initiated the transaction, and that it
will eventually be commited.
This allows you to do multiple pulls or a combination of pulls and
commits in a single transaction.
Closes: #525
Approved by: cgwalters
Colin Walters [Thu, 6 Oct 2016 16:56:18 +0000 (12:56 -0400)]
Release 2016.11
Closes: #524
Approved by: cgwalters
Colin Walters [Wed, 5 Oct 2016 14:13:33 +0000 (10:13 -0400)]
libglnx: Update to latest
This pulls in a new compilation flag for wrpseudo compatibility. Also
note we need to add some includes since glnx-libcontainer went away,
and with it some includes for `sys/mount.h` etc.
Closes: #522
Approved by: cgwalters
Colin Walters [Wed, 14 Sep 2016 20:08:24 +0000 (16:08 -0400)]
trivial-httpd: Port mostly to fd-relative
We were seeing some weird potential memory corruption in this code
when using it for `rpm-ostree-toolbox installer`, which is almost
certainly not its fault, but let's use it as an excuse to port
(mostly) to fd-relative and away from GFile.
Dropping the last GFile use here is a bit tricky as it does have a
nice high level wrapper around inotify.
Closes: #512
Approved by: jlebon
Colin Walters [Tue, 4 Oct 2016 19:39:15 +0000 (15:39 -0400)]
checkout: Fix fsync defaults for new API to be off for real
My previous change in https://github.com/ostreedev/ostree/pull/425
actually broke things so we basically used the repository defaults =(
This is a subtle mess since we're only trying to flip things off
for the *new* API.
Clean this up so that the "default repo inheritance" lives only in one
place - in the compat layer for the old checkout API. The new
checkout API defaults to off period, so the repository state is
irrelevant.
Closes: #520
Approved by: jlebon
Simon McVittie [Sat, 1 Oct 2016 15:07:08 +0000 (16:07 +0100)]
Fix spelling of "repository"
Detected by Debian's Lintian tool.
Signed-off-by: Simon McVittie <smcv@debian.org>
Closes: #519
Approved by: cgwalters
Dan Nicholson [Thu, 22 Sep 2016 16:13:39 +0000 (09:13 -0700)]
admin: Allow running status unlocked
It's useful to let non-root see the current system status.
Closes: #515
Closes: #516
Approved by: jlebon
Jonathan Lebon [Tue, 20 Sep 2016 16:04:41 +0000 (12:04 -0400)]
docs: add mention of rpm-ostree package layering
Closes: #514
Approved by: cgwalters
Jonathan Lebon [Tue, 20 Sep 2016 15:45:57 +0000 (11:45 -0400)]
ostree_sysroot_init_osname: also create /var/log
/var/log is another one of those core directories that should be made
available and properly labeled during early boot before tmpfiles.d
starts up.
Related: https://bugzilla.redhat.com/show_bug.cgi?id=
1265295
Closes: #513
Approved by: cgwalters
Colin Walters [Wed, 14 Sep 2016 16:56:07 +0000 (12:56 -0400)]
boot: Ensure we remount /var writable before systemd does journal flush
Otherwise, we may not get a persistent journal for the first boot.
https://bugzilla.redhat.com/show_bug.cgi?id=
1265295
Closes: #511
Approved by: jlebon
Colin Walters [Wed, 14 Sep 2016 00:38:21 +0000 (20:38 -0400)]
sysroot: Drop an unnecessary fsync
While looking at a slow update issue (which I'm guessing is
unpredictable I/O latency in an OpenStack instance), I noticed
in one of the traces we were inside a fsync here.
Dropping the fsync here is just another of a long series of unwinding
them - we `syncfs()` the sysroot fd and `/boot` and we have a big
`sync()` anyways.
Closes: #508
Approved by: jlebon
Colin Walters [Wed, 14 Sep 2016 01:09:48 +0000 (21:09 -0400)]
sysroot: Drop an fsync for origin file when writing deployments
More fsync pruning. Since we have a public API for writing the origin
file and it did a fsync before, let's preserve that. But when writing
deployments as part of a full transaction, we rely on the global
`syncfs()`, so add an internal function for origin file writing that
doesn't.
Closes: #509
Approved by: giuseppe
Colin Walters [Wed, 14 Sep 2016 01:05:08 +0000 (21:05 -0400)]
sysroot: Port origin writing code to fd-relative
Just preparatory cleanup for a next patch which makes
the fsyncing configurable.
Closes: #509
Approved by: giuseppe
Colin Walters [Wed, 14 Sep 2016 01:26:38 +0000 (21:26 -0400)]
sysroot: Port some small cleanup code to fd-relative
Just a quick patch since I saw this function scroll by in Emacs and it
was too ugly not to be rewritten.
Closes: #510
Approved by: giuseppe
Owen W. Taylor [Tue, 13 Sep 2016 13:05:52 +0000 (09:05 -0400)]
ostree_sysroot.c: Don't close sysroot_fd twice.
If ostree_sysroot_unload() was called explicitly, then sysroot_fd
would be closed again at finalization time, possibly closing a
random file descriptor belonging to some other part of the
application.
Closes: #507
Approved by: cgwalters
Owen W. Taylor [Tue, 13 Sep 2016 13:03:53 +0000 (09:03 -0400)]
ostree-repo.c: Fix file descriptor cleanup
0 was used as an "unset" flag for tmp_dir_fd, which is technically
incorrect. For cache_dir_fd, -1 was used as the sentinal but 0
was checked for, resulting in close(-1).
Closes: #507
Approved by: cgwalters
Colin Walters [Mon, 12 Sep 2016 00:33:42 +0000 (20:33 -0400)]
pull: Do allow executing deltas when mirroring into bare{,-user}
In https://github.com/ostreedev/ostree/pull/408 we fixed a
bug where we would crash when trying to execute deltas into
an archive repo (which isn't presently supported).
But that was overly aggressive - we obviously *can* execute deltas
when mirroring into a bare repo. This should fix a regression with
the way flatpak uses mirroring to pull from a user repo into the
system.
Closes: #506
Approved by: alexlarsson
Jonathan Lebon [Fri, 9 Sep 2016 18:52:18 +0000 (14:52 -0400)]
static-delta: add some error handling
We make _ostree_parse_delta_name() a bit more defensive since it handles
user input.
Closes: #504
Closes: #505
Approved by: cgwalters
Colin Walters [Thu, 8 Sep 2016 20:54:00 +0000 (16:54 -0400)]
Release 2016.10
Closes: #502
Approved by: cgwalters
Colin Walters [Thu, 8 Sep 2016 20:50:35 +0000 (16:50 -0400)]
core: Make OSTREE_TIMESTAMP public API
This way e.g. flatpak can detect which timestamp it should use.
See `flatpak/common/flatpak-utils.c:flatpak_zero_mtime`.
Closes: #501
Approved by: cgwalters
Colin Walters [Thu, 8 Sep 2016 17:38:08 +0000 (13:38 -0400)]
sysroot: Avoid double cleanup, and ensure no cleanup if specified
Since forever, we've been doing two cleanups. In
https://github.com/ostreedev/ostree/commit/
8ece4d6d51bdbe3e41ab318259276bb83e553aa0
I thought we were doing just one and wanted to go to zero (if specified),
but I actually just dropped one cleanup.
In https://github.com/projectatomic/rpm-ostree/pull/452
@jlebon pointed out the duplication. Fix this by creating a new internal
deploy wrapper that takes cleanup flags.
(Since we already had the "piecemeal cleanup" API internally, let's
frame it in terms of that, rather than passing down a boolean).
Closes: #500
Approved by: jlebon
Colin Walters [Thu, 8 Sep 2016 16:39:42 +0000 (12:39 -0400)]
fetcher: Fix another finalization deadlock
If the current repo is already up to date (we have no content to
fetch), it's possible for the fetcher to not request any URIs. So
create and then finalize it quickly.
Finalization involves calling `g_main_loop_quit()` +
`g_thread_wait()`. However, if `g_main_loop_quit()` is run *before*
`g_main_loop_run()`, we'll deadlock because GMainLoop assumes in
`_run()` to start things.
This is a common trap - ideally, GMainLoop would record if `_quit()`
was called before `_run()` or something, but doing that now would
likely break people who are expecting quit() -> run() to restart.
In general, we've moved in various GLib-consuming apps to an
explicit "main context iteration with termination condition" model;
see `pull_termination_condition()` in the pull code.
This fixes this race condition.
I verified that an assertion in `_finalize` that more than
zero URIs were requested was hit in multiple test cases, and this patch
has survived a while of make check loops.
Closes: https://github.com/ostreedev/ostree/issues/496
Closes: #499
Approved by: jlebon
Colin Walters [Thu, 8 Sep 2016 14:47:33 +0000 (10:47 -0400)]
delta: Unreference files we've processed
This should help avoid address space exhaustion on 32 bit systems,
and in general is obviously going to improve efficiency.
Closes: #498
Approved by: alexlarsson
Colin Walters [Thu, 1 Sep 2016 20:09:30 +0000 (16:09 -0400)]
repo: Only use mmap() for metadata > 16k
See http://stackoverflow.com/questions/258091/when-should-i-use-mmap-for-file-access
and
https://lwn.net/Articles/591978/
I didn't really notice much performance difference in some small
tests, but I happened to be stracing and realized we were `mmap()`ing
even for 50 bytes which is not very useful, so let's not do it.
Closes: #489
Approved by: alexlarsson
Colin Walters [Thu, 8 Sep 2016 14:29:10 +0000 (10:29 -0400)]
delta: Add missing `goto out` for failure to mmap()
This was hit in practice when generating a delta for a flatpak app on ARM
it looks like.
Closes: #497
Approved by: alexlarsson
Colin Walters [Thu, 8 Sep 2016 11:11:52 +0000 (07:11 -0400)]
repo: Revert default timestamp from 1 back to 0
Quoting Dan Nicholson in
<https://github.com/ostreedev/ostree/pull/330#issuecomment-
245499099>
mtime of 0 has been the semantics of ostree deployments from basically
the beginning of the project. We (and others, see
flatpak/flatpak@
b5204c9) rely on that fact when generating trees.
In particular, this affects caches that use the mtime of the
associated file or directory to determine if the cache is valid. By
arbitrarily changing the mtime of the files to something else, all
the caches we setup in the build are now invalidated. Preseeding
caches is really important to the user experience as it avoids
having the user wait while they're regenerated on first run.
Now, we could change our build infrastructure to preset all the
mtimes to 1 to match this change, but what does that do for our
existing users who are on an ostree that deploys with mtimes of 0?
We could just revert this change at Endless (and the associated one
in Flatpak), and that would be fine for our users. However, if we
point non-Endless users to our apps, they'll have the great
experience of waiting 10 seconds the first time they launch it while
the fontconfig cache is rebuilt unnecessarily.
Closes: #495
Approved by: jlebon
Giuseppe Scrivano [Wed, 7 Sep 2016 10:15:26 +0000 (12:15 +0200)]
gpg: do not segfault when the algorithm name is not known
Reported by: Patrick Uiterwijk
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Closes: #494
Approved by: cgwalters
William Manley [Wed, 31 Aug 2016 16:15:48 +0000 (17:15 +0100)]
ostree-prepare-root: Fix running with musl
musl libc's implementation of `realpath` works by opening the path and then
doing a lookup in `/proc/self/fd` to find the canonical path. This fails
if `/proc` is not mounted. This causes problems for us if
`ostree-prepare-root` is `init` as `/proc` won't be mounted.
We have to mount `/proc` anyway for `/proc/cmdline` so this fix just
expands the scope over which `/proc` is mounted to include both our
`realpath` calls.
See also:
* http://www.openwall.com/lists/musl/2016/06/08/2 and
* http://git.musl-libc.org/cgit/musl/tree/src/misc/realpath.c?id=
e738b8cbe64b6dd3ed9f47b6d4cd7eb2c422b38d
Closes: #485
Approved by: cgwalters
William Manley [Wed, 31 Aug 2016 16:07:17 +0000 (17:07 +0100)]
ostree-prepare-root: Error if realpath fails
I've seen it fail with musl which needs `/proc` to be mounted for it to
work. The error messages we're rather confusing before. At least this
now points to the right location.
Closes: #485
Approved by: cgwalters
William Manley [Wed, 31 Aug 2016 17:14:19 +0000 (18:14 +0100)]
switchroot: Fix test-switchroot now autotools can build static
This test previously depended on manually building ostree-prepare-root.
Since
42dab85 we've been able to build static binaries with the usual
autotools build-system. This change reflects the fact that
`ostree-prepare-root` is built into $srcdir rather than `src/switchroot`
where I was building manually.
This test now passes with `./configure --with-static-compiler=gcc` (glibc)
but still fails with `./configure --with-static-compiler=musl-gcc` (musl).
Closes: #485
Approved by: cgwalters
William Manley [Wed, 31 Aug 2016 16:25:22 +0000 (17:25 +0100)]
switchroot: Fix build on Ubuntu
Was failing with error:
src/switchroot/ostree-prepare-root.c:30:20: fatal error: config.h: No such file or directory
compilation terminated.
Reported by and fix provided by @gatispaeglis.
Closes: #485
Approved by: cgwalters
Dan Nicholson [Thu, 1 Sep 2016 18:29:26 +0000 (11:29 -0700)]
build: Actually distribute man page XML source
The make substitution pattern was wrong. The source files are
"ostree.xml", not "ostree.1.xml", for instance.
Closes: #488
Approved by: cgwalters
Dan Nicholson [Thu, 1 Sep 2016 18:29:26 +0000 (11:29 -0700)]
build: Distribute man page XML source
Without this, the manual pages can't actually be regenerated from a dist
tarball, and running make clean will remove all traces of them.
Closes: #486
Approved by: cgwalters
Dan Nicholson [Thu, 1 Sep 2016 18:26:48 +0000 (11:26 -0700)]
build: Set --enable-man during distcheck
If xsltproc is not installed, then ENABLE_MAN will be false and the
generated man pages won't be distributed. Pass --enable-man to enforce
that the man pages will be generated and distributed.
Closes: #486
Approved by: cgwalters
Jonathan Lebon [Wed, 31 Aug 2016 17:16:36 +0000 (13:16 -0400)]
pull code: clean up mirrorlist hack
While converting the mirrorlist code from using GSList to GPtrArray, I
completely missed the fact that there is now a much cleaner way to do
this.
Closes: #484
Approved by: cgwalters
Jonathan Lebon [Thu, 25 Aug 2016 19:34:34 +0000 (15:34 -0400)]
tests: add tests for contenturl and mirrorlist
Closes: #469
Approved by: cgwalters